package com.yshy.moviechoseseatinginnerapi.controller;

import com.yshy.moviechoseseatinginnerapi.service.CitiesService;
import com.yshy.moviechoseseatingcommon.entity.bo.cities.ListByProvinceCodeBo;
import com.yshy.moviechoseseatingcommon.entity.bo.cities.LocateByLongitudeAndLatitudeBo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 城市api
 * @create: 下午1:40
 **/
@RestController
@RequestMapping("/cities")
public class CitiesController {
    @Autowired
    private CitiesService citiesService;

    /**
     * 查询中国大陆所有城市
     * @return
     */
    @PostMapping("/V1ListAll")
    public String V1ListAll(){
        return citiesService.v1ListAll();
    }
    /**
     * 查询中国大陆所有城市(V2)
     * @return
     */
    @PostMapping("/V2ListAll")
    public String V2ListAll(){
        return citiesService.v2ListAll();
    }
    /**
     * 根据经纬度定位城市
     * @return
     */
    @PostMapping("/locateByLongitudeAndLatitude")
    public String locateByLongitudeAndLatitude(@RequestBody @Valid LocateByLongitudeAndLatitudeBo bo){
        return citiesService.locateByLongitudeAndLatitude(bo);
    }
    /**
     * 获取中国大陆省份
     * @return
     */
    @PostMapping("/provincesListAll")
    public String provincesListAll(){
        return citiesService.provincesListAll();
    }
    /**
     * 根据省份编号获取城市
     * @return
     */
    @PostMapping("/listByProvinceCode")
    public String listByProvinceCode(@RequestBody @Valid ListByProvinceCodeBo bo){
        return citiesService.listByProvinceCode(bo);
    }
}
